﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;

namespace iVision
{
    /// <summary>
    /// Interaction logic for Main.xaml
    /// </summary>
    public partial class MainMenu : Page
    {
        public MainMenu()
        {
            InitializeComponent();
           
        }

        private void btnCustomers_Click(object sender, RoutedEventArgs e)
        {
            popCustomers.IsOpen = true;
        }

        private void btnNewCustomer_Click(object sender, RoutedEventArgs e)
        {

        }

        private void btnExistingCustomer_Click(object sender, RoutedEventArgs e)
        {

            //Allow user to select customer.

            SelectCustomer selectCustomer = new SelectCustomer();
            selectCustomer.Return += SelectCustomerReturn;

            NavigationService nav = NavigationService.GetNavigationService(this);
            nav.Navigate(selectCustomer);
           
            
        }

        private void btnOrders_Click(object sender, RoutedEventArgs e)
        {
            popOrders.IsOpen = true;
        }

        private void btnNewOrder_Click(object sender, RoutedEventArgs e)
        {

        }

        private void btnExistingOrders_Click(object sender, RoutedEventArgs e)
        {

        }

        void SelectCustomerReturn(object sender, ReturnEventArgs<string> e)
        {
            NavigationService
                nav = ((PageFunctionBase)sender).NavigationService;
            CustomerDetails cust = new CustomerDetails();
            cust.ClientID = e.Result.ToString();
            nav.Navigate(cust);
        }
    }
}
